// 折线图
const colors = ['#73a1f9', '#dcf7ec', '#ffa970', '#1e1e1e']
export const Lineoption = {
    color: colors,
    tooltip: {
        trigger: 'none',
        axisPointer: {
            type: 'cross'
        }
    },
    legend: {},
    grid: {
        top: 70,
        bottom: 70
    },
    xAxis: [
        {
            type: 'category',
            axisTick: {
                alignWithLabel: true
            },
            axisLine: {
                onZero: false,
                lineStyle: {
                    color: colors[3]
                }
            },
            axisPointer: {
                label: {
                    formatter: function (params:any) {
                        return (
                            ' 新增客户总数 ' +
                            params.value +
                            (params.seriesData.length
                                ? '：' + params.seriesData[0].data
                                : '')
                        )
                    }
                }
            },
            // prettier-ignore
            data: ['2024/08/29', '2024/08/30', '2024/08/31', '2024/09/01', '2024/09/02', '2024/09/03', '2024/09/04']
        },
        {
            type: 'category',
            axisTick: {
                alignWithLabel: true
            },
            axisLine: {
                onZero: false,
                lineStyle: {
                    color: colors[0]
                }
            },
            axisPointer: {
                label: {
                    formatter: function (params:any) {
                        return (
                            'Precipitation  ' +
                            params.value +
                            (params.seriesData.length ? '：' + params.seriesData[0].data : '')
                        );
                    }
                }
            }
            // prettier-ignore
            // data: ['2015-1', '2015-2', '2015-3', '2015-4', '2015-5', '2015-6', '2015-7', '2015-8', '2015-9', '2015-10', '2015-11', '2015-12']
        }
    ],
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: [
        {
            type: 'line',
            xAxisIndex: 1,
            smooth: true,
            emphasis: {
                focus: 'series'
            },
            data: [
                2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0,
                100
            ]
        },
        {
            type: 'line',
            xAxisIndex: 1,
            smooth: true,
            emphasis: {
                focus: 'series'
            },

            data: [
                2.8, 50, 9.0, 26.4, 28.7, 70.7, 175.6, 159, 48.7, 18.8, 6.0, 2.3
            ],
            markLine: {
                silent: true,
                lineStyle: {
                    color: 'pink'
                }
            }
        },
        {
            type: 'line',
            smooth: true,
            emphasis: {
                focus: 'series'
            },
            data: [
                3.9, 5.9, 11.1, 18.7, 48.3, 69.2, 231.6, 46.6, 55.4, 18.4, 10.3,
                0.7
            ],
            markLine: {
                silent: true,
                lineStyle: {
                    color: 'red'
                }
            }
        }
    ]
}

//饼图
const data = [
    {
        name: '335(38.11%)',
        value: 70
    },
    {
        name: '235(30.11%)',
        value: 68
    },
    {
        name: '178(23.11%)',
        value: 48
    }
]
export const Pieoption = {
    title: [
        {
            left: '16.67%',
            top: '75%',
            textAlign: 'center'
        }
    ],
    series: [
        {
            type: 'pie',
            radius: ['32%', '70%'], // 考虑调整这个比例来适应更窄的图表
            center: ['30%', '60%'], // 调整中心位置
            data: data,
            label: {
                position: 'outer',
                alignTo: 'none',
                bleedMargin: 2
            }
            // 移除左、右、顶、底的属性，因为它们会影响图表的位置
        }
    ]
}
// 柱状图
export const Histogramoption = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {},
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: [
        {
            type: 'category',
            data: ['美团', '饿了么', '其他平台']
        }
    ],
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: [
        {
            name: '男性',
            type: 'bar',
            stack: 'Ad',
            emphasis: {
                focus: 'series'
            },
            data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
            name: '女性',
            type: 'bar',
            stack: 'Ad',
            emphasis: {
                focus: 'series'
            },
            data: [220, 182, 191, 234, 290, 330, 310]
        },
        {
            name: '未知',
            type: 'bar',
            stack: 'Ad',
            barWidth: 90,
            emphasis: {
                focus: 'series'
            },
            data: [150, 232, 201, 154, 190, 330, 410]
        }
    ]
}
